index.html.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb phone_none">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <div class="breadcrumb_box pc_none">
  23. <span class=" ">当前位置:</span>
  24. <NuxtLink to="/">首页</NuxtLink>
  25. <span class=" ">&gt;</span>
  26. <span class=" ">{{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}</span>
  27. </div>
  28. <!-- 资讯列表 -->
  29. <div class="newsDetail">
  30. <div class="inner">
  31. <div class="innerDetail">
  32. <div class="headImg"></div>
  33. <div class="innerDetail1">
  34. <div class="leftBottom" v-html="newsDetail.content"></div>
  35. </div>
  36. <div class="footImg"></div>
  37. </div>
  38. <div class="innerLeft phone_none">
  39. <ul>
  40. <li>
  41. 导航列表
  42. </li>
  43. <li v-for="(item, index) in bottomMenu" :key="index">
  44. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  45. :class="item.id == pageId ? 'active' : ''">
  46. {{ item.name }}
  47. </NuxtLink>
  48. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  49. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  50. {{ item.name }}
  51. </NuxtLink>
  52. </li>
  53. </ul>
  54. </div>
  55. <div style="clear: both;"></div>
  56. </div>
  57. </div>
  58. <!-- 广告二 -->
  59. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  60. <!-- 页面底部 -->
  61. <HomeFoot1></HomeFoot1>
  62. </template>
  63. <script setup>
  64. //1.页面依赖 start ---------------------------------------->
  65. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  66. import { ArrowRight } from '@element-plus/icons-vue'
  67. import { ref, onMounted } from 'vue';
  68. //获得跳转过来的id
  69. const route = useRoute();
  70. //获得当前的完整路径
  71. const fullPath = route.path;
  72. //拆分,取出来中间这一段,然后提取数字部分
  73. const segments = fullPath.split('/');
  74. const targetSegment = segments[2];
  75. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  76. let num = ref(0)
  77. let articleId;
  78. let pageId;
  79. //通过导航路径反向查询导航id
  80. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  81. method: 'GET',
  82. query: {
  83. 'foot_pinyin': targetSegment,
  84. },
  85. });
  86. if (getRouteId.code == 200) {
  87. articleId = getRouteId.data.id;
  88. pageId = getRouteId.data.id;
  89. } else {
  90. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  91. console.log("错误位置:通过url路径查询导航池id")
  92. console.log("后端错误反馈:", getRouteId.message)
  93. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  94. }
  95. //1.页面依赖 end ---------------------------------------->
  96. //2.页面数据 start ---------------------------------------->
  97. //广告列表
  98. const adList = ref([]);
  99. let adImg1 = ref([]);
  100. let adImg2 = ref([]);
  101. async function getAdData() {
  102. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  103. adList.value = adData.data;
  104. if (adData.code == 200) {
  105. for (let item of adData.data) {
  106. if (item.ad_tag == 'PAGE_0001') {
  107. adImg1.value = item;
  108. }
  109. if (item.ad_tag == 'PAGE_0002') {
  110. adImg2.value = item;
  111. }
  112. }
  113. } else {
  114. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  115. console.log("错误位置:获取详情页广告列表")
  116. console.log("后端错误反馈:", adData.message)
  117. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  118. }
  119. }
  120. getAdData();
  121. const newsDetail = ref({})
  122. const bottomMenu = ref([]);
  123. async function getPageData() {
  124. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  125. method: 'GET',
  126. query: {
  127. 'fcat_id': articleId,
  128. 'type': 0
  129. },
  130. });
  131. newsDetail.value = mkdata.data;
  132. }
  133. getPageData();
  134. async function getPageMenu() {
  135. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  136. method: 'GET',
  137. query: {},
  138. });
  139. if (mkdata.code == 200) {
  140. bottomMenu.value = mkdata.data;
  141. mkdata.data.forEach((item, index) => {
  142. if (item.id == articleId) {
  143. num.value = index;
  144. }
  145. });
  146. }
  147. }
  148. getPageMenu();
  149. //2.页面数据 end ---------------------------------------->
  150. //4.设置seo信息 start---------------------------------------->
  151. //4.1 设置seo信息
  152. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  153. method: 'GET',
  154. query: {},
  155. });
  156. let seoTitle = setData.data.website_head.title;
  157. let seoDescription = setData.data.website_head.description;
  158. let seoKeywords = setData.data.website_head.keywords;
  159. let seoSuffix = setData.data.website_head.suffix;
  160. let seoName = setData.data.website_head.website_name;
  161. useSeoMeta({
  162. title: seoTitle + "_" + seoSuffix,
  163. meta: [
  164. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  165. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  166. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  167. ]
  168. });
  169. //4.设置seo信息 end---------------------------------------->
  170. onMounted(async () => {
  171. //从客户端获取行政职能部门 加快打开速度
  172. const { $webUrl, $CwebUrl } = useNuxtApp();
  173. //广告1
  174. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_page_0001`
  175. const responseAd1 = await fetch(url, {
  176. headers: {
  177. 'Content-Type': 'application/json',
  178. 'Userurl': $CwebUrl,
  179. 'Origin': $CwebUrl
  180. }
  181. });
  182. const resultAd1 = await responseAd1.json();
  183. adImg1.value = resultAd1.data[0];
  184. //广告2
  185. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_page_0002`
  186. const responseAd2 = await fetch(url2, {
  187. headers: {
  188. 'Content-Type': 'application/json',
  189. 'Userurl': $CwebUrl,
  190. 'Origin': $CwebUrl
  191. }
  192. });
  193. const resultAd2 = await responseAd2.json();
  194. adImg2.value = resultAd2.data[0];
  195. })
  196. </script>
  197. <style lang="less" scoped>
  198. @import '@/assets/css/about.less';
  199. </style>
  200. <style lang="less" scoped>
  201. @media screen and (min-width:801px){/*pc*/
  202. .pc_none{display:none;}
  203. }
  204. @media screen and (max-width:800px){/*ipad_phone*/
  205. .breadcrumb_box{
  206. height:22px;width:100%;margin:10px auto;
  207. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  208. width:92%;
  209. font-size:14px;
  210. color:#666;
  211. *{
  212. font-size:14px;
  213. display:inline ;
  214. color:#666;
  215. line-height:22px;height:22px;
  216. margin-right:5px;
  217. }
  218. }
  219. .newsDetail {margin:10px auto 20px;}
  220. .newsDetail .inner{width:92%;margin:0px auto 8px;overflow:hidden;}
  221. .newsDetail .inner .innerRight{width:24%; display:none;}
  222. .newsDetail .inner .innerRight .rightMenuTitle{width:100%;height:auto; background-size:100% 155%; margin-bottom:11px;
  223. display:block;width:100%;height:auto;line-height:33px;font-size:14px;text-align:center;}
  224. .newsDetail .inner .innerRight .rightMenuTitle a{}
  225. .newsDetail .inner .innerRight ul{display:block;width:100%;height:auto;}
  226. .newsDetail .inner .innerRight ul li{display:block;width:100%;height:auto;}
  227. .newsDetail .inner .innerRight ul li a {line-height:20px;height:auto;font-size:12px;margin-bottom:5px;padding: 6px 2px;box-sizing:border-box;
  228. border-left: 2px solid #028E21;}
  229. .newsDetail .inner .innerLeft{ width:100%;float:none;overflow:hidden;margin:0;}
  230. .newsDetail .inner .innerLeft .book_son_right{float:none;width:100%;overflow:hidden;margin-bottom:22px;}
  231. .newsDetail .inner .innerLeft .leftBottomTitle{height:50px;line-height:50px;font-size:18px;}
  232. .newsDetail .inner .innerLeft .leftBottom{width:100%; padding-top:11px;line-height:22px;font-size:16px!important;
  233. /deep/img{ width:100%;height:auto;}
  234. }
  235. .newsDetail .inner .innerDetail{width:100%;margin-bottom:0px;}
  236. .newsDetail .inner .innerDetail .innerDetail1{width:100%;padding:0;border:none;background:#fff;}
  237. .newsDetail .inner .innerDetail .leftBottom,.newsDetail .inner .innerDetail .leftBottom *{ line-height:22px;font-size:16px!important;}
  238. .newsDetail .inner .innerDetail .leftBottom{border:solid 1px #dd7d18;padding:10px;box-sizing:border-box;}
  239. .footImg{display:none;}
  240. .headImg{display:none;}
  241. .phone_none{display:none;}
  242. }
  243. </style>